package
{
	import flash.display.Sprite;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	import flash.events.Event;
	import flash.filesystem.File;
	import flash.geom.Rectangle;
	import flash.media.StageWebView;
	
	public class realmap extends Sprite
	{
		protected static const ASSETS_PATH:String = "assets/";
		protected static const HTML_PATH:String = ASSETS_PATH + "html/";
		
		protected static const STATIC_PATH:String = ASSETS_PATH + "static/";
		protected static const CSS_PATH:String = STATIC_PATH + "css/";
		protected static const JS_PATH:String = STATIC_PATH + "js/";
		protected static const IMG_PATH:String = STATIC_PATH + "img/";
		
		
		public function realmap()
		{
			super();
			
			// support autoOrients
			stage.align = StageAlign.TOP_LEFT;
			stage.scaleMode = StageScaleMode.NO_SCALE;
			
			this.addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
		}
		
		private function onAddedToStage(e:Event):void
		{
			var url:String = "file://" + HTML_PATH + "index.html";
			var resultsPageUrl:String = File.applicationDirectory.resolvePath("assets/html/index.html").nativePath;
			
			var fPath:String = new File(new File("app:/assets/html/index.html").nativePath).url;
			
			var webStage:StageWebView = new StageWebView();
			webStage.stage = this.stage;
			webStage.viewPort = new Rectangle(0, 0, this.stage.width, this.stage.height);
			
			webStage.loadURL( fPath);
		}
	}
}